<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
var arr1=new Array(12,55,34,78,676);
var arr2=new Array(12,33, 1);

Array.prototype.sum=function ()	//class
//arr1.sum=function ()				//行间样式
{
	var result=0;
	
	for(var i=0;i<this.length;i++)
	{
		result+=this[i];
	}
	
	return result;
};

alert(arr1.sum());
alert(arr2.sum());	//?
</script>
</head>

<body>
</body>
</html>
